#include <iostream>
using namespace std;

int main()
{
    int q;
    cin >> q;
    int a, b, c,ans;
    while (q--)
    {
        cin >> a >> b >> c;
        int numsmin=min(min(a,b),c);
        ans=2*numsmin;
        a-=numsmin;b-=numsmin;c-=numsmin;
        if(b>=2)
        {
            ans+=b-1;
        }
        cout<<ans<<endl;
    }

    return 0;
}
